package com.guigu.qingcheng.service;

import com.guigu.qingcheng.entity.OrderItemLog;
import com.guigu.qingcheng.entity.TbOrder;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@Component
@FeignClient("service-order")
public interface CartService {

    @GetMapping("serviceorder/cart/findCartList")
    public List<Map<String,Object>> findCartList(@RequestParam("username") String username);

    @GetMapping("serviceorder/cart/addItem")
    public void addItem(@RequestParam("username") String username,@RequestParam("skuId") String skuId,@RequestParam("num") Integer num);

    @GetMapping("serviceorder/cart/updateChecked")
    public void updateChecked(@RequestParam("username") String username,@RequestParam("skuId") String skuId,@RequestParam("checked") boolean checked);


    @GetMapping("serviceorder/cart/deleteCheckedCart")
    public void deleteCheckedCart(@RequestParam("username") String username);

    @GetMapping("serviceorder/cart/preferential")
    public Map preferential(@RequestParam("username") String username);

    @GetMapping("serviceorder/cart/findNewOrderItemList")
    public List<Map<String,Object>> findNewOrderItemList(@RequestParam("username") String username);

    /**
     * 保存订单
     * @param order
     * @return
     */
    @PostMapping("serviceorder/order/saveOrder")
    public Map<String,Object> saveOrder(@RequestBody TbOrder order,@RequestParam("username") String username);

    /**
     * 微信支付
     * @param orderId
     * @param username
     * @param notifyUrl
     * @return
     */
    @GetMapping("serviceorder/wxpay/createNative")
    public Map createNative(@RequestParam("orderId") String orderId,@RequestParam("username") String username,@RequestParam("notifyUrl") String notifyUrl);

    /**
     * 微信支付回调
     * @param xml
     */
    @GetMapping("serviceorder/wxpay/notify")
    public void notifyLogic(@RequestParam("xml") String xml);

    /**
     * 我的订单
     * @param username
     * @return
     */
    @GetMapping("serviceorder/center/orderItemLogList")
    public List<OrderItemLog> orderItemLogList(@RequestParam("username") String username);

    /**
     * 查询我未付款的订单
     * @return
     */
    @GetMapping("serviceorder/center/orderPayList")
    public List<OrderItemLog> orderPayList(@RequestParam("username") String username);

    /**
     * 查询我未收货的订单
     * @param username
     * @return
     */
    @GetMapping("serviceorder/center/orderReceiveList")
    public List<OrderItemLog> orderReceiveList(@RequestParam("username") String username);

    /**
     * 查询我未收货的订单
     * @return
     */
    @GetMapping("serviceorder/center/centerOrderSend")
    public List<OrderItemLog> centerOrderSend(@RequestParam("username") String username);


    /**
     * 确认收货
     * @param orderId
     * @return
     */
    @GetMapping("serviceorder/center/updateconsignStatus")
    public void updateconsignStatus(@RequestParam("orderId") String orderId);


}
